Skip Headers

Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-01 |
Home | Book List | Contents | Index | Master Index | Feedback

Previous | Next
| View PDF

# $COUNTVAR

The $COUNTVAR property specifies the same behavior as that specified by a COUNTVAR clause in an AGGREGATE command or an AGGREGATE function. By adding an $COUNTVAR property to a variable you can ensure this behavior when the variable is aggregated — even when it is aggregated by an AGGREGATE statement does not include the COUNTVAR clause.

The behavior specified by both the $COUNTVAR property and the COUNTVAR clause is that Oracle OLAP uses a variable that you have previously-defined (sometimes called a Countvar variable) to store the non-`NA` counts of the number of leaf nodes that contributed to aggregate values calculated for RELATION (for aggregation) statements that have an AVERAGE, HAVERAGE, HWAVERAGE, or WAVERAGE operator.

Note: Typically, you do not use a user-defined Countvar variable to store the counts for average aggregations; instead, you use an Oracle OLAP-created Aggcount variable. You cannot use a Countvar variable when the aggregation specification includes a RELATION (for aggregation) statement with one of the average operators is for a compressed composite. See "Aggcount Variables" for more information.

Syntax

You add or delete a $COUNTVAR property to the most recently defined or considered object (see DEFINE and CONSIDER) using a PROPERTY statement:

- To add the property, issue the following statement.

  PROPERTY '$COUNTVAR' countvar

- To delete the property, issue the following statement.

  PROPERTY DELETE '$COUNTVAR'

Arguments

countvar

  A `TEXT` expression that specifies the name of a previously defined Countvar variable. The Countvar variable must be an `INTEGER` variable with exactly the same dimensions in exactly the same order as the dimensions as the variable on which you add the $COUNTVAR property.

Examples

Example 6-5 Using $COUNTVAR

For a variable named `v1`, the following statements cause Oracle OLAP to count the number of leaf nodes that contributed to an aggregate value that is the result of the execution of the `myaggmap` aggmap object by a AGGREGATE function.

    CONSIDER v1
    PROPERTY '$COUNTVAR' 'mycountvar'